package class_3;

import java.util.Random;
public class Coding_GcbAndLcm {
	public static long gcb(long a, long b) {
		return b==0L? a : gcb(b,a%b);
	}
	
	public static long lcm(long a, long b) {
		return (long)a/gcb(a, b)*b;
	}
	public static int bound = 10000;
	public static void main(String[] args) {
		Random random = new Random();
		long a,b;
		
		a = random.nextLong(0, bound);
		b = random.nextLong(0, bound);
		if(a<b) {
			long temp = a;
			a = b;
			b = temp;
		}
		System.out.printf("a:%d, b:%d\n",a,b);
		System.out.println("最大公约数:"+ gcb(a,b));
		System.out.println("最小公倍数:"+ lcm(a,b));
	}
}
